/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/09/08
*/
#ifndef __EDUI_PROGRESS_H__
#define __EDUI_PROGRESS_H__

#include "Control.h"

EDUI_NAMESPACE_BEGIN

class EDUI_API Progress : public Control
{
public:
    struct {
        Event1<Progress*> progress;
    } evt;
protected:
    Progress();
    virtual ~Progress();
public:
	static Progress* GetInterface();
	virtual void Release();
    static Progress* ToProgress(Control* ctrl);
public:
    virtual bool SetValue(int val);
    int GetValue() const;
    void SetMaxValue(int val);
    int GetMaxValue() const;
    void SetMinValue(int val);
    int GetMinValue() const;

    // "hl"(default),"hr","vu","vd"
    void SetType(const char* type);
    const char* GetType() const;

    virtual bool SetBarInset(const Rect1* inset);
    Rect1 GetBarInset() const;

    virtual Rect GetBarRect();
    virtual Rect GetBarBkRect();
protected:
    virtual bool HandleMsg(Msg* msg);
    virtual void RenderStatusImages(IRender* render, const Rect* rc);
    virtual void SetAttribute(const char* name, const char* value);
    virtual ImageData* GetDestImageData(const char* dstname);

    virtual void DoEvent(EventType type, void* data1 = 0, void* data2 = 0);
protected:
    ImageData m_barBkImage;
    ImageData m_barBkNormalImage;
    ImageData m_barBkHotImage;
    ImageData m_barBkPressedImage;
    ImageData m_barBkDisabledImage;

    ImageData m_barImage;
    ImageData m_barNoramlImage;
    ImageData m_barHotImage;
    ImageData m_barPressedImage;
    ImageData m_barDisabledImage;

    ButtonState m_barState;
    ButtonState m_barBkState;

    int m_val;
    int m_minVal;
    int m_maxVal;

    int m_type;
    Rect1 m_barInset;
};

EDUI_NAMESPACE_END

#endif
